package com.mostromas.ess.feign;

import com.mostromas.ess.util.base.Result;
import com.mostromas.ess.util.enums.PlatformEnum;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

// value 指定是哪个微服务接口， path 是在 Feign 调用时会加上此前缀，对应实现类服务的 context-path
@FeignClient(value="product-server", path = "/product")
public interface IFeignFileController {

    @ApiOperation("上传文件到OSS")
    @PostMapping(value = "/api/feign/file/upload",consumes = "multipart/form-data")
    public Result upload(@RequestPart("file") MultipartFile file);

    @ApiOperation("删除OOS服务器的文件")
    @ApiImplicitParam(name="fileUrl", value="要删除的文件URL", required=true)
    @DeleteMapping("/api/feign/file/delete")
    public Result delete(@RequestParam(value = "fileUrl", required = false) String fileUrl);
}
